
import UIKit
import Reusable

class MainHomeTableViewCell: UITableViewCell,NibReusable {
    
    @IBOutlet weak var titleL: UILabel!
    @IBOutlet weak var gsView: UIView!
    @IBOutlet weak var dbView: UIView!
    @IBOutlet weak var cpView: UIView!
    @IBOutlet weak var dwView: UIView!
    @IBOutlet weak var zwView: UIView!
    @IBOutlet weak var hjView: UIView!
    @IBOutlet weak var hbView: UIView!
    
    typealias swiftBlock = (_ btnTag : Int) -> Void
    var callBack: swiftBlock?
    
    func callBackBlock(block: @escaping swiftBlock) {
        callBack = block
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        selectionStyle = .none
        backgroundColor = .clear
        

        getCor(view: zwView)
        getCor(view: dwView)
        getCor(view: cpView)
        getCor(view: dbView)
        getCor(view: gsView)
        getCor(view: hjView)
        getCor(view: hbView)
        
        let tap1 = UITapGestureRecognizer(target: self, action: #selector(viewClick1))
        zwView.addGestureRecognizer(tap1)
        
        let tap2 = UITapGestureRecognizer(target: self, action: #selector(viewClick2))
        dwView.addGestureRecognizer(tap2)
        
        let tap3 = UITapGestureRecognizer(target: self, action: #selector(viewClick3))
        cpView.addGestureRecognizer(tap3)
        
        let tap4 = UITapGestureRecognizer(target: self, action: #selector(viewClick4))
        dbView.addGestureRecognizer(tap4)
        
        let tap5 = UITapGestureRecognizer(target: self, action: #selector(viewClick5))
        gsView.addGestureRecognizer(tap5)
        
        let tap6 = UITapGestureRecognizer(target: self, action: #selector(viewClick6))
        hjView.addGestureRecognizer(tap6)
        
        let tap7 = UITapGestureRecognizer(target: self, action: #selector(viewClick7))
        hbView.addGestureRecognizer(tap7)
    }
    
    @objc func viewClick1(){
        if self.callBack != nil {
            self.callBack!(1)
        }
    }
    
    @objc func viewClick2(){
        if self.callBack != nil {
            self.callBack!(2)
        }
    }
    
    @objc func viewClick3(){
        if self.callBack != nil {
            self.callBack!(3)
        }
    }
    
    @objc func viewClick4(){
        if self.callBack != nil {
            self.callBack!(4)
        }
    }
    
    @objc func viewClick5(){
        if self.callBack != nil {
            self.callBack!(5)
        }
    }
    
    @objc func viewClick6(){
        if self.callBack != nil {
            self.callBack!(6)
        }
    }
    
    @objc func viewClick7(){
        if self.callBack != nil {
            self.callBack!(7)
        }
    }
    
    private func getCor(view:UIView){
        
        view.layer.cornerRadius = 10
        view.layer.masksToBounds = true
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
